﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Ledict.Core.Data;
using System.Data.Common;
using Ledict.ConditionExtract.Model;
using Ledict.ConditionExtract.Common;

namespace Ledict.ConditionExtract.DAL
{
   public  class Express_AddElementDAL
    {
         private  string DbName;
         public Express_AddElementDAL()
       {
           DbName = "JudgeDoc";
       }
         public bool AddExpress_AddElement(string  StiuatonId,   string StiuatonName)
        {
            Database oBase = DatabaseFactory.CreateDatabase(DbName);
            DbCommand oCmd = oBase.GetStoredProcCommand("sp_CondiExt_AddExpress_AddElement");
            oBase.AddInParameter(oCmd, "@StiuatonId", DbType.String, StiuatonId);
            oBase.AddInParameter(oCmd, "@StiuatonName", DbType.String, StiuatonName);
            return   oBase.ExecuteNonQuery(oCmd)>0?true :false ;
        }
         public DataTable GetAllElement()// delete dbo.SYS_Express_AddElement
         {
             StringBuilder strSql = new StringBuilder();
             strSql.Append(@"select * from dbo.SYS_Express_AddElement
	            delete dbo.SYS_Express_AddElement     ");

             Database oBase = DatabaseFactory.CreateDatabase(DbName);
             DbCommand oCmd = oBase.GetSqlStringCommand(strSql.ToString ());

             DataTable OtB = oBase.ExecuteDataSet(oCmd).Tables[0];
             if (OtB.Rows.Count > 0)
             {
                 return OtB;
             }
             else
             {
                 return new DataTable();
             }

         }


    }
}
